package com.cskaoyan.bean.vo.vxVo;

import lombok.Data;


/**
 * @author by WANGJun
 * @date 2022/6/7 16:55
 */
@Data
public class HandleOptionBean {
    /**
     * cancel : false  由订单状态码确认
     * delete : true   由order.deleted确认
     * pay : false     由状态码确认，仅101可以
     * comment : true  由order_goods.comment=0表示true
     * confirm : false 由状态码确认，仅301可以
     * refund : false  由状态码确认，仅301,401可以
     * rebuy : true    由comment确认，如果comment为true，则为false
     * aftersale : true 由状态码确认，如果40X则为true
     */

    private boolean cancel;
    private boolean delete;
    private boolean pay;
    private boolean comment;
    private boolean confirm;
    private boolean refund;
    private boolean rebuy;
    private boolean aftersale;

    public static HandleOptionBean data(Integer status, Integer aftersaleStatus, Integer comment){
        if (status==null){ System.out.println("这回null了");return null;}
        HandleOptionBean handleOptionBean = new HandleOptionBean();
        if (status==101){handleOptionBean.cancel=true;}else {handleOptionBean.cancel=false;}
        if (status==102||status==103||status==203){handleOptionBean.delete=true;}else {handleOptionBean.delete=false;}
        if (status==101){handleOptionBean.pay=true;}else {handleOptionBean.pay=false;}
        if (comment==null||comment==0||(status!=401&&status!=402)){handleOptionBean.comment=false;}else {handleOptionBean.comment=true;}
        if (status==301){handleOptionBean.confirm=true;}else {handleOptionBean.confirm=false;}
        if (status==201){handleOptionBean.refund=true;}else {handleOptionBean.refund=false;}
        if (comment==null||comment!=0){handleOptionBean.rebuy=false;}else {handleOptionBean.rebuy=true;}
        if (aftersaleStatus==0&&(status==401||status==402)){handleOptionBean.aftersale=true;}else {handleOptionBean.aftersale=false;}
        return handleOptionBean;
    }
}
